package com.example.springmall.service;

import com.example.springmall.entity.Goods;
import com.example.springmall.mapper.GoodsMapper;

import lombok.RequiredArgsConstructor;

import org.springframework.stereotype.Service;

import java.util.List;

@Service
@RequiredArgsConstructor
public class GoodsService {
    
    private final GoodsMapper goodsMapper;
        
    public List<Goods> listGoods() {
        return goodsMapper.selectGoodsList();
    }
    
    public Goods getGoodsById(Long id) {
        return goodsMapper.selectGoodsById(id);
    }
    
    public boolean deleteGoodsById(Long id) {
        return goodsMapper.deleteGoodsById(id) > 0;
    }
} 